function some(letters, letter) {
    for (var item of letters) {
        // item: 'a', 'u', 'i', 'o', 'e'
        if (item === letter) {
            return true;
        }
    }
    return false;
}

function getCount(word, letters) {
    var counter = 0;
    for (var letter of word) {
        // console.log(letter); // 'h', 'e', ...
        if (some(letters, letter)) {
            counter++;
        }
    }
    return counter;
}

function getCount(word, letters) {
    var counter = 0;
    for (var letter of word) {
        // 在数组中查找是否有某一项
        if (letters.some(item => item === letter)) {
            counter++;
        }
    }
    return counter;
}

var letters = ['a', 'u', 'i', 'o', 'e'];
console.log(getCount('hello', letters)); // 2
console.log(getCount('hello world', letters)); // 3
